﻿using System;

namespace Framework
{
    public class Shape : UIElement
    {
        static Shape()
        {
            RegisterType(typeof(Shape), typeof(UIElement));
            RegisterProp(typeof(Shape), "Fill", typeof(Brush), null);
            RegisterProp(typeof(Shape), "Stroke", typeof(Brush), null);
            RegisterProp(typeof(Shape), "StrokeMiterLimit", typeof(double), null);
            RegisterProp(typeof(Shape), "StrokeThickness", typeof(double), null);
            RegisterProp(typeof(Shape), "StrokeStartLineCap", typeof(PenLineCap), null);
            RegisterProp(typeof(Shape), "StrokeEndLineCap", typeof(PenLineCap), null);
            RegisterProp(typeof(Shape), "StrokeLineJoin", typeof(PenLineJoin), null);
            RegisterProp(typeof(Shape), "StrokeDashOffset", typeof(double), null);
            RegisterProp(typeof(Shape), "StrokeDashCap", typeof(PenLineCap), null);
            RegisterProp(typeof(Shape), "StrokeDashArray", typeof(Collection<Double>), null);
            RegisterProp(typeof(Shape), "Stretch", typeof(Stretch), null);
            RegisterProp(typeof(Shape), "GeometryTransform", typeof(Transform), null);
        }

        public double StrokeThickness
        {
            get { return (double)GetProp("StrokeThickness"); }
            set { SetProp("StrokeThickness", value); }
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }
    }

    public sealed class Line : Shape
    {
        static Line()
        {
            RegisterType(typeof(Line), typeof(Shape));
            RegisterProp(typeof(Line), "X1", typeof(double), null);
            RegisterProp(typeof(Line), "Y1", typeof(double), null);
            RegisterProp(typeof(Line), "X2", typeof(double), null);
            RegisterProp(typeof(Line), "Y2", typeof(double), null);
        }

        public double X1
        {
            get { return (double)GetProp("X1"); }
            set
            {    
                SetProp("X1", value);
            }
        }

        public double Y1
        {
            get { return (double)GetProp("Y1"); }
            set
            {
                SetProp("Y1", value);
            }
        }

        public double X2
        {
            get { return (double)GetProp("X2"); }
            set
            {
                SetProp("X2", value);
            }
        }

        public double Y2
        {
            get { return (double)GetProp("Y2"); }
            set
            {
                SetProp("Y2", value);
            }
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }
    }

    public sealed class Rectangle : Shape
    {
        static Rectangle()
        {
            RegisterType(typeof(Rectangle), typeof(Shape));
            RegisterProp(typeof(Rectangle), "RadiusX", typeof(Double), null);
            RegisterProp(typeof(Rectangle), "RadiusY", typeof(Double), null);
        }

        public double RadiusX
        {
            get { return (double)GetProp("RadiusX"); }
            set
            {
                SetProp("RadiusX", value);
            }
        }


        public double RadiusY
        {
            get { return (double)GetProp("RadiusY"); }
            set
            {
                SetProp("RadiusY", value);
            }
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }

    }

    public sealed class Ellipse : Shape
    {
        static Ellipse()
        {
            RegisterType(typeof(Ellipse), typeof(Shape));
            RegisterProp(typeof(Ellipse), "RadiusX", typeof(Double), null);
            RegisterProp(typeof(Ellipse), "RadiusY", typeof(Double), null);
        }

        public double RadiusX
        {
            get { return (double)GetProp("RadiusX"); }
            set
            {
                SetProp("RadiusX", value);
            }
        }

        public double RadiusY
        {
            get { return (double)GetProp("RadiusY"); }
            set
            {
                SetProp("RadiusY", value);
            }
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }
    }

    public sealed class Polyline : Shape
    {
        static Polyline()
        {
            RegisterType(typeof(Polyline), typeof(Shape));
            RegisterProp(typeof(Polyline), "FillRule", typeof(FillRule), null);
            RegisterProp(typeof(Polyline), "Points", typeof(Collection<Point>), null);
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }
    }

    public sealed class Polygon : Shape
    {
        static Polygon()
        {
            RegisterType(typeof(Polygon), typeof(Shape));
            RegisterProp(typeof(Polygon), "FillRule", typeof(FillRule), null);
            RegisterProp(typeof(Polygon), "Points", typeof(Collection<Point>), null);
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }
    }

    public class Path : Shape
    {
        static Path()
        {
            RegisterType(typeof(Path), typeof(Shape));
            RegisterProp(typeof(Path), "Data", typeof(Geometry), null);
        }

        public override void OnRender(DrawingContext drawingContext)
        {
        }
    }

}
